import { http } from '@/utils/http'

/**
 * 用户信息
 */
export function userInformation(): Promise<IResData<IUserInfo>> {
  return http.get('/api/nongshang/information')
}

/**
 * 修改用户资料
 */
export function editUserInfomation(params: IEditUser): Promise<IResData<any>> {
  return http.post('/api/nongshang/information_submit', params, params)
}

/**
 * 意见反馈内容提交
 */
export function feedback(content: string): Promise<IResData<any>> {
  return http.post('/api/nongshang/feedback', { content }, { content })
}

/**
 * 我的需求
 */
export function myDemand(params: IPage): Promise<IResData<IPageRes<IDemand>>> {
  return http.get('/api/nongshang/my_service', params)
}

/**
 * 我的优惠券
 */
export function myCoupon(): Promise<IResData<IPageCouponRes<ICoupon>>> {
  return http.get('/api/nongshang/my_coupon')
}

/**
 * 优惠券使用记录
 */
export function couponRecord(): Promise<IResData<IPageRes<ICouponRecord>>> {
  return http.get('/api/nongshang/my_coupon_record')
}
/**
 * 优惠券核销
 */
export function checkCoupon(id: string): Promise<IResData<any>> {
  return http.post('/api/nongshang/check_coupon', { id }, { id })
}

/**
 * 需求报送删除
 */
export function deleteDemand(id: string): Promise<IResData<any>> {
  return http.get('/api/nongshang/my_service_del', { id })
}

/**
 * 我的分佣
 */
export function myCommission(params: IPage): Promise<IResData<IPageCommissionRes<ICommission>>> {
  return http.get('/api/nongshang/my_commission', params)
}

/**
 * 客服投诉电话
 */
export function getComplaintPhone(): Promise<IResData<string>> {
  return http.get('/api/nongshang/service_phone')
}

